package models.mappers;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import vos.OperatorSearchVo;
import models.Operator;
import models.Operator;

public interface OperatorMapper {
	/**
	 * 根据id查找操作员
	 *
	 * @Title: findById 
	 * @param operatorid 操作员id
	 * @return
	 * @return: Operator
	 */
	@Select("select * from "
			+ Operator.TABLE_NAME
			+" where operatorid=#{operatorid} and isflag=0")
	Operator findById(String operatorid);
	/**
	 * 修改密码
	 *
	 * @Title: updatePass 
	 * @param oldoper 新密码
	 * @return: void
	 */
	@Update("update "
			+ Operator.TABLE_NAME
			+" set password=#{password},modifytime=#{modifytime},modifyname=#{modifyname}"
			+ " where operatorid=#{operatorid}")
	void updatePass(Operator oldoper);
	/**
	 * 统计列表行数
	 *
	 * @Title: countHraDetail 
	 * @param vo
	 * @return
	 * @return: long
	 */
	long countOperator(OperatorSearchVo vo);
	/**
	 * 获取列表数据
	 *
	 * @Title: listHraStandard 
	 * @param vo
	 * @return
	 * @return: List<Standard>
	 */
	List<Operator> listOperator(OperatorSearchVo vo);
	/**
	 * 批量启用操作员
	 *
	 * @Title: betchEnable 
	 * @param listid 操作员id列表
	 * @return
	 * @return: Boolean
	 */
	void betchEnable(Map<String, Object> map);
	/**
	 * 批量停用操作员
	 *
	 * @Title: betchEnable 
	 * @param listid 操作员id列表
	 * @return
	 * @return: Boolean
	 */
	void betchDisable(Map<String, Object> map);
	/**
	 * 批量删除操作员
	 *
	 * @Title: betchDel 
	 * @param map
	 * @return: void
	 */
	void betchDel(Map<String, List<String>> map);
	/**
	 * 根据id删除操作员
	 *
	 * @Title: delOperator 
	 * @param id
	 * @return: void
	 */
	@Delete("delete from "
			+ Operator.TABLE_NAME
			+" where operatorid=#{id}")
	void delOperator(String id);
	/**
	 * 根据id判断是否存在该操作员
	 *
	 * @Title: checkCode 
	 * @param operatorid
	 * @return
	 * @return: String
	 */
	@Select("select 1 from "
			+ Operator.TABLE_NAME
			+" where operatorid=#{operatorid}")
	String checkCode(String operatorid);
	/**
	 * 根据id获取操作员信息
	 *
	 * @Title: getById 
	 * @param operatorid 操作员id
	 * @return
	 * @return: Operator
	 */
	@Select("select * from "
			+ Operator.TABLE_NAME
			+" where operatorid=#{operatorid}")
	Operator getById(String operatorid);
	/**
	 * 保存操作员信息
	 *
	 * @Title: saveOperator 
	 * @param operator
	 * @return: void
	 */
	@Insert("insert into "
			+ Operator.TABLE_NAME
			+" (operatorid,operatorname,password,operatoraddress,operatormobile,isflag,createtime,createname,salt,email) values"
			+ "(#{operatorid},#{operatorname},#{password},#{operatoraddress},#{operatormobile},#{isflag},#{createtime},#{createname},#{salt},#{email})")
	void saveOperator(Operator operator);
	/**
	 * 更新操作员信息
	 *
	 * @Title: updateOperator 
	 * @param operator
	 * @return: void
	 */
	@Update("update "
			+ Operator.TABLE_NAME
			+" set operatorname=#{operatorname},operatoraddress=#{operatoraddress},"
			+ "operatormobile=#{operatormobile},isflag=#{isflag},"
			+ "modifyname=#{modifyname},modifytime=#{modifytime},email=#{email}"
			+ "where operatorid=#{operatorid}")
	void updateOperator(Operator operator);
	/**
	 * 重置操作员密码
	 *
	 * @Title: rePassword 
	 * @param oper 操作员
	 * @return: void
	 */
	@Update("update "
			+ Operator.TABLE_NAME
			+" set password=#{password} where operatorid=#{operatorid}")
	void rePassword(Operator oper);
	/**
	 * 统计列表行数
	 *
	 * @Title: countHraDetail 
	 * @param vo
	 * @return
	 * @return: long
	 */
	long countUseOperator(OperatorSearchVo vo);
	/**
	 * 获取启用的操作员列表
	 *
	 * @Title: listUseOperator 
	 * @param vo
	 * @return
	 * @return: List<Operator>
	 */
	List<Operator> listUseOperator(OperatorSearchVo vo);
}
